//
// Created by lenovo on 2023/12/14.
//
#include<bits/stdc++.h>
using namespace std;
int pri(int n)
{
    if(1 == n || 0 == n)
        return 0;
    int k = (int) sqrt(n);
    for(int i = 2;i <= k;i++)
    {
        if(n % i == 0)
            return 0;
    }
    return 1;
}
int main()
{
    int t = 0;
    cin >> t;
    while(t--)
    {
        int i = 0,ans = 0;
        cin >> i;
        for(i;i > 0;i--)
        {
            int num = 0;
            cin >> num;
            if(pri(num))
                ans++;

        }
        cout << ans << endl;
    }
    return 0;
}